<?php include TMPL_PATH.'public/header.phtml';?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
    	<div style="float:left;margin-right:50px;">
        <a href='javascript:;' class="on"><em>批发管理</em></a><span>|</span><a href='<?php echo U('promotion/wholesale_add');?>' ><em>添加批发方案</em></a>
      </div>
    	<div style="color:#000;">
    		<form name="searchform" action="__SELF__"  method="post">
    		商品名称：<input type="text" class="input-text" value="<?php echo $searchkeyword;?>" name="product_name">
				<input type="submit" value="搜索" class="button" name="search">
    		</form>
    	</div>
    </div>
</div>
<div class="bk"></div>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th width="150">ID号</th>
            <th align='left' width="300">商品名称</th>
            <th align='center' width="150">适用会员等级</th>
            <th align='center' width="100">启用</th>
						<th align='center' width="100">管理操作</th>
						<th></th>
            </tr>
        </thead>
    <tbody>
    <?php
   	if(isset($wholesaleList) && $wholesaleList):
   		foreach ($wholesaleList as $v):
   ?>
			<tr>
					<td align='center'><?php echo $v['id']?></td>
					<td align='left'><?php echo $v['product_name'];?></td>
					<td align='center'>
					<?php
					if(empty($v['rank_ids'])){
						echo '所有人';
					}else{
						$rank_ids = explode(',', $v['rank_ids']);
						$cont = count($rank_ids);
						$i=0;
						foreach ($rank_ids as $rid){
							if($rankList[$rid]){
								if($i>0 && $i<$cont)echo ',';
								echo $rankList[$rid]['name'];
								$i++;
							}
						}
					}
					?>
					</td>
					<td align="center"><?php if($v['display']==1){?><font color="red">√</font><?php }else{?><font color="blue">×</font><?php }?></td>
					<td align='center'> 
					<a href="<?php echo U('promotion/wholesale_edit', 'wid='.$v['id']);?>">编辑</a>
					&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:confirmurl('<?php echo U('promotion/wholesale_delete', 'wid='.$v['id']);?>','确认要删除 吗？')">删除</a>
					</td>
					<td></td>
				</tr>
	<?php 
		endforeach;
		endif;
	?>
   </tbody>
    </table>
<div id="pages"><?php echo $pageShow;?></div>
</div>
</div>
</body>
</html>
